//
//  BSSDescribeMessageTableViewCell.m
//  PreschoolEducation
//
//  Created by 传铎 on 2020/11/17.
//  Copyright © 2020 李传铎. All rights reserved.
//

#import "BSSDescribeMessageTableViewCell.h"

@implementation BSSDescribeMessageTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = [UIColor clearColor];
        [self createUI];
        [self layoutUI];
    }
    return self;
}

- (void)createUI {
    [self.contentView addSubview:self.titleLab];
    [self.contentView addSubview:self.describeLab];
    [self.contentView addSubview:self.line];
}

- (void)layoutUI {

    [_titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(__kSize(15));
        make.top.mas_equalTo(__kSize(12));
    }];
    [_describeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_titleLab.mas_bottom).mas_offset(__kSize(12));
        make.right.mas_equalTo(__kSize(- 22));
        make.left.mas_equalTo(15);
    }];
    [_line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_describeLab.mas_bottom).mas_offset(__kSize(12));
        make.left.mas_equalTo(__kSize(22));
        make.right.mas_equalTo(__kSize(- 22));
        make.height.mas_equalTo(0.5);
        make.bottom.mas_equalTo(self.contentView);
    }];
}
- (void)setModel:(BSSEnterpriseCertificationModel *)model{
    _model = model;
    _describeLab.text = model.value;
}

#pragma mark - action

#pragma mark - setter & getter

- (UILabel *)titleLab {
    if (!_titleLab) {
        _titleLab = [UILabel new];
        _titleLab.textColor = __kColor(51, 51, 51);
        _titleLab.font = fontCount(14);
    }
    return _titleLab;
}
- (UILabel *)describeLab{
    if (!_describeLab){
        _describeLab = [UILabel new];
        _describeLab.numberOfLines = 0;
        _describeLab.textColor = __kColor(51, 51, 51);
        _describeLab.font = fontCount(14);
    }
    return _describeLab;
}
- (UIView *)line {
    if (!_line) {
        _line = [UIView new];
        _line.backgroundColor = __kColor(238, 238, 238);
    }
    return _line;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
